#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@IDE     ：PyCharm 
@Author  ：kiway
@Date    ：2024/11/10 13:38 
"""

import asyncio
import time


def _maker2taker():
    """对超时还未成交的maker单进行监控，超时后直接撤单转成taker单"""

    loop = asyncio.get_event_loop()

    while True:
        cancel_task = []
        renew_task = []

        for k in range(20):
            cancel_task.append(asyncio.sleep(1))
            renew_task.append(asyncio.sleep(2))

        async def wrapp_task(task1, task2):
            await asyncio.gather(*task1)
            print("task 1 completed")
            await asyncio.gather(*task2)
            print("task 2 completed")

        loop.run_until_complete(wrapp_task(cancel_task, renew_task))


if __name__ == '__main__':
    _maker2taker()
